package com.dxj1992.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dxj1992.entity.SteamBalances;
import com.dxj1992.mapper.SteamBalancesMapper;
import com.dxj1992.service.ISteamBalancesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jobob
 * @since 2022-04-08
 */
@Service
public class SteamBalancesServiceImpl extends ServiceImpl<SteamBalancesMapper, SteamBalances> implements ISteamBalancesService {

    @Autowired
    private SteamBalancesMapper steamBalancesMapper;

    @Override
    public Boolean removeData(String ids) {
        String[] split = ids.split(",");
        List<String> idList = Arrays.asList(split);
        for (String id : idList) {
            QueryWrapper<SteamBalances> queryWrapper = new QueryWrapper<>();
            queryWrapper.eq("id", id);
            int row = steamBalancesMapper.delete(queryWrapper);
            if (row == 0) {
                return false;
            }
        }
        return true;
    }
}
